<template>
   <input type="text" v-model="msg"/>
   输出了:{{msg}}
</template>

<script setup lang="ts">
import {customRef} from 'vue'


let msg = delayWrite("zs")


function delayWrite(value){
  return customRef((track,trigger)=>{
    return {
      get(){
        console.log("get调用",value)
        track()
        return value
      },
      set(newValue){
        value = newValue
        setInterval(()=>{
          trigger()
        },600)
       
      }
    }
  });

}




</script>